set :application, "sotools"
set :repository, "http://sotools.svnrepository.com/svn/sotools"

# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/home/mgod/#{application}"
set :user, "mgod"
set :password, "j0.m4m4"
set :checkout, "export"
set :use_sudo, false

# If you aren't using Subversion to manage your source code, specify
# your SCM below:
# set :scm, :subversion

role :app, "sotools.railsplayground.net"
role :web, "sotools.railsplayground.net"
role :db,  "sotools.railsplayground.net", :primary => true

#after "deploy:update_code", "fix_env"
before "deploy:restart", "fix_permissions"
after "deploy:restart", "restart_mongrel"

#task :fix_env do
#  run "export RAILS_ENV=production"
#end

task :fix_permissions do
  run "chmod 755 /home/mgod/sotools/current/public/"
  run "chmod 755 /home/mgod/sotools/current/public/*"
end

# TASKS
task :restart_mongrel, :roles => :app do
  run "cd #{current_path} && mongrel_rails stop"
  run "cd #{current_path} && mongrel_rails start -d -p 4009 -e production"
end